/**
 * 
 */
package com.ziguang.common.interceptor;

import org.apache.commons.lang3.StringUtils;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;
import com.ziguang.common.SysConstant;

/**
 * @author Administrator
 *
 */
public class AuthInterceptor implements Interceptor {
	@Override
	public void intercept(Invocation inv) {
		Controller controller = inv.getController();
		String userName = controller.getSessionAttr(SysConstant.SESSION_INFO);
		if (StringUtils.isNotBlank(userName)) {
			inv.invoke();
		} else {
			controller.redirect("/managerlogin");
		}
	}

}
